package com.gp.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.gp.mapper.BaseCouponDistributionMapper;
import com.gp.mapper.BaseOrderCouponMapper;
import com.gp.model.entity.BaseCouponDistribution;
import com.gp.model.entity.BaseOrderCoupon;
import com.gp.service.IBaseOrderCouponService;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 弓成龙
 * @since 2017-11-26
 */
@Service
public class BaseOrderCouponServiceImpl extends ServiceImpl<BaseOrderCouponMapper, BaseOrderCoupon> implements IBaseOrderCouponService {
  
  @Autowired
  private BaseOrderCouponMapper couponMapper;
  
  @Autowired
  private BaseCouponDistributionMapper couponlogMapper; 
  
  @Override
  public boolean distributeCoupon(Long couponId, List<Long> userIds) {
    for(Long id: userIds) {
      BaseCouponDistribution cd = new BaseCouponDistribution(couponId,id);
      couponlogMapper.insert(cd);
    }
    return true;
   }
	
}
